.tts-spin {
  animation: tts-spin 2s linear infinite;
}

@keyframes tts-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  opacity: 0;
  transition: opacity 500ms ease-in;
}

.fade-in.visible {
  opacity: 1;
}

.tts-toolbar {
}

.tts-toolbar-player {
  display: flex;
  padding: 0 var(--size-4-3);
  height: 32px;
  gap: var(--size-4-2);
  align-items: stretch;
  background-color: var(--background-secondary);
  border-top: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  margin: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: opacity 0.2s ease;
}

.tts-toolbar-player-button-group {
  display: flex;
  align-items: center;
}

.tts-toolbar-player-item-margin-right {
  margin-right: 0.5rem;
}

.tts-audio-status-container {
  flex: 1 1 auto;
  display: flex;
  overflow: hidden;
  align-items: center;
}

.tts-audio-visualizer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 2rem;
  height: 80%;
}

.tts-audio-visualizer-bar {
  background-color: var(--icon-color);
  border-radius: 10px;
  width: 6%;
  transition: height 0.04s linear;
}

.tts-audio-status-error {
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: left;
}

.tts-audio-status-error-text {
  /* marginLeft: `${spacer}`, */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background-color: rgba(var(--background-modifier-error-rgb), 0.5);
  font-style: italic;
  font-size: var(--font-ui-small);
  padding: 0.15rem;
  border-radius: var(--radius-s);
}

.tts-audio-status-loading {
  display: flex;
  justify-content: center;
  align-items: center;
}
.tts-audio-status-error-icon {
  display: inline-flex;
  padding-right: 0.33rem;
  justify-content: center;
  align-items: center;
}

.tts-tab-playing-icon {
  --icon-size: var(--icon-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.tts-tab-playing-icon .tts-toolbar-icon {
  padding-top: 0.1rem;
  padding-right: 0.33rem;
}

/**
 * Settings tab
 */

.tts-settings-model-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
}

@media (max-width: 1024px) {
  .tts-settings-model-header {
    flex-direction: column;
  }
}

.tts-settings-model-header h1 {
  flex: 1 1 auto;
}

.tts-settings-error-container details {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-s);
  background-color: var(--background-primary-alt);
}

.tts-settings-error-container summary:hover {
  cursor: pointer;
}

.tts-settings-error-container summary > div {
  display: inline-flex;
  flex-direction: row;
  float: right;
  width: calc(100% - 1rem);
  justify-content: space-between;
}

details .tts-error-details {
  opacity: 0;
}

details[open] .tts-error-details {
  animation: fadeIn 0.25s linear forwards;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* 自定义音色样式 */
.custom-voices-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-s);
  background-color: var(--background-primary-alt);
}

.custom-voice-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background-color: var(--background-primary);
  border-radius: var(--radius-s);
  border: 1px solid var(--background-modifier-border);
}

.custom-voice-info {
  flex: 1;
  overflow: hidden;
}

.custom-voice-name {
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-voice-description {
  font-size: var(--font-ui-small);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-item-container {
  border-left: 2px solid var(--interactive-accent);
  margin-left: 20px;
  padding-left: 10px;
}

.error-message {
  color: var(--text-error);
  font-style: italic;
}



/* 改进工具栏在没有活动内容时的外观 */
.tts-toolbar-player-button-group button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
